package com.ycfmedical.bed.ui.fragment;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ycfmedical.bed.Constants;
import com.ycfmedical.bed.R;
import com.ycfmedical.bed.adapter.BillCheckAdapter;
import com.ycfmedical.bed.local.entity.BillRecords;
import com.ycfmedical.bed.present.BillCheckPrensenter;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import cn.droidlover.xdroidmvp.mvp.XFragment;
import cn.droidlover.xrecyclerview.XRecyclerContentLayout;

/**
 * Created by Administrator on 2017-04-20.
 */

public class CheckBillFragment extends XFragment<BillCheckPrensenter> {


    BillCheckAdapter billCheckAdapterRecords;
    BillCheckAdapter billCheckAdapterResult;

    @BindView(R.id.billRecords)
    XRecyclerContentLayout billRecords;
    @BindView(R.id.billResult)
    XRecyclerContentLayout billResult;
    Unbinder unbinder;

    @Override
    public void initData(Bundle savedInstanceState) {
        billCheckAdapterRecords = new BillCheckAdapter(getContext(), Constants.BILL_RECORDS);

        billCheckAdapterResult = new BillCheckAdapter(getContext(), Constants.BILL_RESULT);
        // billRecords.;
        billRecords.getRecyclerView().verticalLayoutManager(getContext());
        billRecords.getRecyclerView().setAdapter(billCheckAdapterRecords);
        billRecords.getRecyclerView().setRefreshEnabled(false);

        billResult.getRecyclerView().verticalLayoutManager(getContext());
        billResult.getRecyclerView().setAdapter(billCheckAdapterResult);
        billResult.getRecyclerView().setRefreshEnabled(false);

        getP().loadData();


    }

    /**
     * 显示账单详情记录数据
     */
    public void showRecordsData(List<BillRecords> billRecordsList) {
        billCheckAdapterRecords.addData(billRecordsList);
        billCheckAdapterRecords.notifyDataSetChanged();
    }

    /**
     * 显示费用记录数据 如预交款、已用款等
     */
    public void showResultsData(List<BillRecords> billRecordsList) {
        billCheckAdapterResult.addData(billRecordsList);
        billCheckAdapterResult.notifyDataSetChanged();
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_his_billcheck;
    }

    @Override
    public BillCheckPrensenter newP() {
        return new BillCheckPrensenter();
    }



}
